package com.hx.myapp;

import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;

import android.Manifest;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.hx.myapp.broadcast.BroadActivity;
import com.hx.myapp.datastorage.DataSrorageActivity;
import com.hx.myapp.fragment.ContainerActivity;
import com.hx.myapp.jump.AActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
   private Button mBtnUI,mBtnLife,mBtnJump,mBtnFragment,mBtnEvent,mBtnData,mBtnBroad;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mBtnUI = findViewById(R.id.btn_ui);
        mBtnLife = findViewById(R.id.btn_life);
        mBtnJump = findViewById(R.id.btn_jump);
        mBtnFragment = findViewById(R.id.btn_fragment);
        mBtnEvent = findViewById(R.id.btn_event);
        mBtnData = findViewById(R.id.btn_data);
        mBtnBroad = findViewById(R.id.btn_broad);
        mBtnUI.setOnClickListener(this);
        mBtnLife.setOnClickListener(this);
        mBtnJump.setOnClickListener(this);
        mBtnFragment.setOnClickListener(this);
        mBtnEvent.setOnClickListener(this);
        mBtnData.setOnClickListener(this);
        mBtnBroad.setOnClickListener(this);
        ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()){
            case R.id.btn_ui:
                intent = new Intent(MainActivity.this, UIActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_life:
                intent = new Intent(MainActivity.this, LifeCycleActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_jump:
                intent = new Intent(MainActivity.this, AActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_fragment:
                intent = new Intent(MainActivity.this, ContainerActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_event:
                intent = new Intent(MainActivity.this, EventActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_data:
                intent = new Intent(MainActivity.this, DataSrorageActivity.class);
                startActivity(intent);
                break;
            case R.id.btn_broad:
                intent = new Intent(MainActivity.this, BroadActivity.class);
                startActivity(intent);
                break;

        }

    }
}